/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.ucv.entidades;

import java.io.Serializable;
import javax.persistence.*;


/**
 *
 * @author Conrrad Martínez
 */
@Entity
@Table(name = "requisito")
@NamedQueries({
    @NamedQuery(name = "Requisito.findAll", query = "SELECT r FROM Requisito r"),
    @NamedQuery(name = "Requisito.findById", query = "SELECT r FROM Requisito r WHERE r.id = :id")})
public class Requisito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    //@NotNull comentado porque da conflicto de validación ya que exije que se 
    //ingrese el id manualmente a pesar de haber declarado la anotación 
    //@GeneratedValue(strategy = GenerationType.IDENTITY) para el campo Id
    @Column(name = "ID")
    private Integer id;
    @JoinColumn(name = "REQUISITOCURSO_ID", referencedColumnName = "ID")
    @ManyToOne
    private RequisitoCurso requisitocursoId;
    @JoinColumn(name = "HARDWARE_ID", referencedColumnName = "ID")
    @ManyToOne
    private Hardware hardwareId;
    @JoinColumn(name = "APLICACION_ID", referencedColumnName = "ID")
    @ManyToOne
    private Aplicacion aplicacionId;

    public Requisito() {
    }

    public Requisito(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public RequisitoCurso getRequisitocursoId() {
        return requisitocursoId;
    }

    public void setRequisitocursoId(RequisitoCurso requisitocursoId) {
        this.requisitocursoId = requisitocursoId;
    }

    public Hardware getHardwareId() {
        return hardwareId;
    }

    public void setHardwareId(Hardware hardwareId) {
        this.hardwareId = hardwareId;
    }

    public Aplicacion getAplicacionId() {
        return aplicacionId;
    }

    public void setAplicacionId(Aplicacion aplicacionId) {
        this.aplicacionId = aplicacionId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Requisito)) {
            return false;
        }
        Requisito other = (Requisito) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.ucv.entidades.Requisito[ id=" + id + " ]";
    }
    
}
